<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" name="" id="">
    <button>发送验证码</button>
    <script>
        var btn = document.getElementsByTagName('button')
        var time = 10
        btn[0].addEventListener('click', function (){
            btn[0].disabled = true
            const timer = setInterval(() => {
                if(time !=0){
                    btn[0].innerHTML = time+'秒之后可以再次发送'
                    time --;
                }else{
                    btn[0].innerHTML = '发送验证码'
                    btn[0].disabled = false
                    time =10
                    clearInterval(timer)
                }
            }, 1000);
        })
    </script>
</body>
</html>